#ifndef _NNSLITE_MEMORY_H_
#define _NNSLITE_MEMORY_H_

#include "nnsliteglobal.h"
#include "nnsliteblist.h"

typedef struct nnsliteMemoryContext
{
	nnsliteBlist allocList;
	u64 idcounter;
	void* (*allocMem)(size_t size);
	void  (*freeMem)(void* p);
	NNSLITE_RET (*checkMem)();
}nnsliteMemoryContext;

NNSLITE_RET nnsliteMemoryInit(void);
NNSLITE_RET nnsliteMemoryExit(void);
nnsliteMemoryContext* nnsliteMemoryGetDefaultContext();

#define nnsliteMAlloc(size) (nnsliteMemoryGetDefaultContext()->allocMem(size))
#define nnsliteMFree(p) (nnsliteMemoryGetDefaultContext()->freeMem(p))
#define nnsliteMCheck() (nnsliteMemoryGetDefaultContext()->checkMem())

#endif

